#include <bits/stdc++.h>
using namespace std;

const int MAXN = 13000;
int a[101];
int dp[MAXN] = {0};
int gcd(int a, int b) {
    return b > 0 ? gcd(b, a % b) : a;
}

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) 
        cin >> a[i];
    int g = a[1];
    for (int i = 2; i <= n; i++) 
        g = gcd(g, a[i]);
    if (g != 1) {
        cout << "INF" << endl;
        return 0;
    } 
    for (int i = 1; i <= n; i++) {
        dp[a[i]] = 1;  // 遍历第i个数据 表是那个值是计算过的
        for (int j = 0; j + a[i] < 10000; j++) {
            if (dp[j]) {
                dp[j + a[i]] = 1; // 原本那个可以筹出来的数 + 当前这个数字 也一定是一个能够筹出来的数字
            }
        }
    }
    int res = 0;
    for (int i = 1; i < 10000; i++) {
        if (dp[i] == 0) res++;
    }
    cout << res << endl;
    return 0;
}